﻿using Li.EntityFramework;
using Li.EntityFramework.AppService;
using Li.EntityFramework.IAppService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Li.Web.Controllers
{
    public class HomeController : Controller
    {
        public IUserAppService _userAppService;
        //// GET: Home
        public HomeController(IUserAppService userAppService)
        {
            _userAppService = userAppService;
        }
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Add(User user)
        {
            _userAppService.Add(user);
            _userAppService.SaveChanges();
            return Content("OK");
        }
        public ActionResult GetUser()
        {
            return Json(_userAppService.GetAll());
        }
        public ActionResult GetUserArticle()
        {
            return Json(_userAppService.GetUserArticle());
        }
    }
}